-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditions: Map out-of-date bundleDeployment with an operator condition #134
Conditions: Map out-of-date bundleDeployment with an operator condition #134
Conversation
ad0d8ff
to
bf4c18f
Compare
It("verify operator status when bundle deployment is waiting to be created", func() { | ||
By("running reconcile") | ||
bd.Status.ObservedGeneration = bd.GetGeneration() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hacky, but needed since we are trying to mimic >1 reconcile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better approach might be to have separate When
blocks. Something along these lines, maybe?
When("The bundle deployment status is stale", func() {})
When("The bundle deployment status is up-to-date", func() {
BeforeEach(func() {
bd.Status.ObservedGeneration = bd.GetGeneration()
By("updating the status of bundleDeployment")
err := cl.Status().Update(ctx, bd)
Expect(err).NotTo(HaveOccurred())
}
})
Also, I find it easier to think about these tests not as mimicking multiple reconciles, but more like "what happens during a given Reconcile when the state of the world is X?". And then we would ideally have tests for all the various X's such that we get really good code coverage in Reconcile
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the change, just left the status update call in It
blocks, so that we update the status only once after setting the right conditions.
91a6d6b
to
cc2c737
Compare
It("verify operator status when bundle deployment is waiting to be created", func() { | ||
By("running reconcile") | ||
bd.Status.ObservedGeneration = bd.GetGeneration() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better approach might be to have separate When
blocks. Something along these lines, maybe?
When("The bundle deployment status is stale", func() {})
When("The bundle deployment status is up-to-date", func() {
BeforeEach(func() {
bd.Status.ObservedGeneration = bd.GetGeneration()
By("updating the status of bundleDeployment")
err := cl.Status().Update(ctx, bd)
Expect(err).NotTo(HaveOccurred())
}
})
Also, I find it easier to think about these tests not as mimicking multiple reconciles, but more like "what happens during a given Reconcile when the state of the world is X?". And then we would ideally have tests for all the various X's such that we get really good code coverage in Reconcile
.
cc2c737
to
df92da6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
New changes are detected. LGTM label has been removed. |
This PR brings in the change that sets the operator condition to Unknown when the BundleDeployment's conditions are out od date. Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
0c2e0ae
to
c8b82fd
Compare
@joelanford Re-organized the test cases, please feel free to let me know if you would like to see any other changes. I can do those in follow-ups, merging this for now. |
This PR brings in the change that sets the operator condition to Unknown when the BundleDeployment's conditions are out od date.